from django.contrib import messages


class BaseActionMixin(object): 
 
    @property 
    def action(self): 
        # This method optimized for 
        #   ebook display 
        msg = "{0} is missing action." 
        msg = msg.format( 
                    self.__class__) 
        raise NotImplementedError(msg) 
 
    def form_valid(self, form): 
        # This method optimized for 
        #   ebook display 
        msg = "Message {0}!" 
        msg = msg.format(self.action) 
        messages.info(self.request, msg) 
        return super(BaseActionMixin, 
                self).form_valid(form)